package org.semanticflash.rdf.graph.redirection
{
	import org.semanticflash.rdf.values.IRI;
	import org.semanticflash.rdf.utils.AbstractRDFTest;
	import org.semanticflash.rdf.utils.RDFTestingUtil;

	public class RDFRedirectionContextTest extends AbstractRDFTest
	{


		public static const a:IRI = iri( "a" );
		public static const b:IRI = iri( "b" );
		public static const c:IRI = iri( "c" );
		public static const d:IRI = iri( "d" );





		
		public function test_basic_IRI_redirection( ):void
		{
		
			
			var context:RDFRedirectionContext = new RDFRedirectionContext( );
			
			
			var ar:IRIRedirection = context.getIRIRedirection( a );	
			
				assertEquals( ar.cannonical, a );

			var br:IRIRedirection = context.getIRIRedirection( b );
			
				assertEquals( br.cannonical, b );
				
				
				// redirections are not equal
				assertFalse(  ar.cannonical == br.cannonical  );
				
			context.eq( a, b );
			
				// now they are
				assertTrue(  ar.cannonical == br.cannonical  );
			

			
			
			var cr:IRIRedirection = context.getIRIRedirection( c );
			
				assertEquals( cr.cannonical, c );
			
			
			context.eq( a, c );
				
				// now they are all equal
				assertTrue(  ar.cannonical == br.cannonical  );
				assertTrue(  ar.cannonical == cr.cannonical  );
				assertTrue(  br.cannonical == cr.cannonical  );
			

			
			context.neq( a, b );
			
				// only a,c remains
				assertFalse(  ar.cannonical == br.cannonical  );
				assertTrue(  ar.cannonical == cr.cannonical  );
				assertFalse(  br.cannonical == cr.cannonical  );
				
			
			
		
		}

		
	}
	
}